#pragma once




#include <memory>

#include "Containers/Containers.h"
#include "Path/Path.h"

enum class EFrameOperationType
{
    Instruction,
    
    LoadLiteral,
    LoadFunction,
    
    LoadVariable,
    LoadVariableAddress,
    StoreVariable,

    LoadField,  //include static field
    LoadFieldAddress, //include static field
    StoreField, //include static field

    BinocularOperation,

    FunctionCall,
    ConstructorCall,
    VirtualFunctionCall,
    
    LoadArgument,
    LoadArgumentAddress,
    StoreArgument,
    
    BoxInnerType,

    NewObject,
    InitValueType,

    Return,
    Jump,
    Switch,
    DoNothing,

    InnerTypeConvertion,

    CastClass,
};

class CScriptFileContext;

class IFrameOperation
{
public:
    virtual ~IFrameOperation() = default;

    virtual EFrameOperationType GetType() const = 0;

    // index in function body
    int LineIndex=-1;


    void SetBreakpointInfo(std::shared_ptr<CScriptFileContext> InFile, uint32_t InFileLineIndex)
    {
        assert(InFile);
        File = InFile;
        FileLineIndex = InFileLineIndex;
    }

    bool IsBreakable() const
    {
        return File.HasValue();
    }

    TOptional<std::shared_ptr<CScriptFileContext>> File;
    TOptional<uint32_t> FileLineIndex;
};


